All Questions
6 questions
0votes
1answer
56views
is my Prim's MST implementation terse enough?
I did research because I want to learn Kruskal's and Prim's MSTs. I did research and after a solid understanding, I went to my textbook and got their libraries: https://algs4.cs.princeton.edu/code/...
5votes
2answers
13kviews
Java: Given a list of edges, build a tree and return the root
In an interview I was asked to write Java code to build a tree and return the root, given a list of edges. It was a fairly open ended question where the interviewer left all the decisions up to me. I ...
1vote
1answer
738views
Check directed graph is tree or not
Here is my approach. 1. Checking there is no cycle.(Using BFS) 2. All nodes are connected. (visited) ...
3votes
0answers
297views
Kruskal's algorithm in Java - follow-up
The previous and initial iteration at Kruskal's algorithm in Java Now what I did is remove the fields and let the actual Kruskal-routine create the required data structures in the local scope, ...
6votes
2answers
10kviews
Kruskal's algorithm in Java
I have this Java implementation of Kruskal's algorithm. It solves a tiny problem instance correctly, yet I am not quite sure, whether my implementation is correct. The code as follows: MSTFinder....
5votes
1answer
8kviews
Prims algorithm implementation
Review this code regarding optimization, cleanup, and best practices. ...